package com.chessimo.printer;

import java.awt.Graphics;
import java.awt.Image;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;

import com.chessimo.config.Definitions;

public class RowInfoDB extends JPanel implements MouseListener {
	private static final long serialVersionUID = 1L;

	private Image backgroud = new ImageIcon("images/fundo_linha.PNG").getImage();
	private int x = 180;
	private int y;
	private JLabel number;
	private JLabel name1;
	private JLabel name2;
	private JLabel placar;
	
	private JPanel icoWhitePanel;
	private JPanel icoBlackPanel;
	

	public RowInfoDB(String number, String name1, String name2, String placar, int y) {
		setLayout(null);
		this.number = new JLabel(number);
		this.number.setBounds(50, 25, 100, 30);
		this.number.setFont(Definitions.fontInfoDBTitle);
		this.name1 = new JLabel(name1);
		this.name1.setBounds(150, 15, 400, 30);
		this.name1.setFont(Definitions.fontInfoDB);
		this.name2 = new JLabel(name2);
		this.name2.setBounds(150, 37, 400, 30);
		this.name2.setFont(Definitions.fontInfoDB);
		this.placar = new JLabel(placar);
		this.placar.setBounds(880, 25, 80, 30);
		this.placar.setFont(Definitions.fontInfoDB);
		
		this.icoWhitePanel = new ImageIconPanel(new ImageIcon("images/ico-user-white.PNG").getImage());
		this.icoWhitePanel.setBounds(120, 20, 400, 30);
		
		this.icoBlackPanel = new ImageIconPanel(new ImageIcon("images/ico-user-black.PNG").getImage());
		this.icoBlackPanel.setBounds(120, 42, 400, 30);
		
		this.y = y;
		setBounds(x, y, this.backgroud.getWidth(null), this.backgroud.getHeight(null));

		addMouseListener(this);
		add(this.number);
		add(this.name1);
		add(this.name2);
		add(this.placar);
		add(icoWhitePanel);
		add(icoBlackPanel);

		setSize(this.backgroud.getWidth(null), this.backgroud.getHeight(null));
		setVisible(true);
	}

	public void paintComponent(Graphics g) {
		g.drawImage(backgroud, 0, 0, null);
	}

	public void mouseClicked(MouseEvent arg0) {
		System.out.println(this.number.getText());
	}// evento q sera executado caso o mouse click no panel

	public void mouseEntered(MouseEvent arg0) {
	}// evento q sera executado caso o mouse entre no panel

	public void mouseExited(MouseEvent arg0) {
	}// evento q sera executado caso o mouse saia do panel

	public void mousePressed(MouseEvent arg0) {
	}// evento q sera executado caso o mouse seja pressionado no label

	public void mouseReleased(MouseEvent arg0) {
	}// evento q sera executado caso o mouse seja largado no label

	public static void main(String[] args) {
	}

}